home *** CD-ROM | disk | FTP | other *** search
- #include "MacHeaders7"
- #include "Utils.h"
- #include "MSM.h"
-
- /* FlushCache flushes the 680x0 instruction cache in a compatible way across all CPUs. */
-
- void FlushCache(void) {
- if (CPUFlag < 2) return;
- asm 68020 {
- movem.l d0/d1/a0,-(a7)
- move.w #0xA098,d0
- GetTrapAddress NEWOS
- move.l a0,a1
- move.w #0xA89F,d0
- GetTrapAddress NEWTOOL
- cmp.l a0,a1
- beq.s @direct
- moveq #1,d0
- dc.w 0xA098 ; _HWPriv
- goto restore
- direct: movec cacr,d1
- addq.w #8,d1
- movec d1,cacr
- restore:movem.l (a7)+,d0/d1/a0
- };
- }
-
-
- /* real address converts a Think C code resource-based jump table entry
- into an actual address. */
-
- void *real_address(void *jump_table_entry) {
- asm {
- move.l jump_table_entry,a0
- cmpi.w #0x6000,(a0)
- bne.s @fine
- addq #2,a0
- add.w (a0),a0
- fine:
- move.l a0,d0
- StripAddress
- };
- }
-
- // jbRelString is an interface to the RelString trap. It returns zero
- // if the strings are equal, 1 if s1 is greater that s2, -1 if neither.
-
- short jbRelString(register void *first, register void *second) {
- asm {
- moveq #0,d0
- move.l first,a0
- move.l second,a1
- move.b (a0)+,d0
- swap d0
- move.b (a1)+,d0
- RelString
- out:;
- }
- }